(function(){"use strict";BX.namespace("BX.Main.ui");BX.Main.ui.Factory=function(){if(BX.Main.ui.Factory instanceof BX.Main.ui.Factory){return BX.Main.ui.Factory}this.data=[];this.classControl="main-ui-control";this.classSelect="main-ui-select";this.classMultiSelect="main-ui-multi-select";this.classDate="main-ui-date";this.maxEventPathDepth=5;this.init()};BX.Main.ui.Factory.prototype={init:function(){BX.bind(document,"click",BX.delegate(this._onHandleEvent,this));document.addEventListener("focus",BX.delegate(this._onHandleEvent,this),true)},_onHandleEvent:function(t){this.prepareEvent(t);t.path.forEach(function(i,n){if(!this.validateIteration(i,n)){return false}if(this.isSelect(i)&&!this.isControlInitialized(i)){var e={node:i,instance:new BX.Main.ui.select(i)};this.data.push(e);e.instance._onControlClick(t)}if(this.isDate(i)&&!this.isControlInitialized(i)){var a={node:i,instance:new BX.Main.ui.date(i)};this.data.push(a)}},this)},validateIteration:function(t,i){return i<=this.maxEventPathDepth&&BX.type.isDomNode(t)},prepareEvent:function(t){if(!("path"in t)||!t.path.length){t.path=[t.target];var i=0;var n;while((n=t.path[i++].parentNode)!==null){t.path.push(n)}}},isSelect:function(t){return BX.hasClass(t,this.classSelect)||BX.hasClass(t,this.classMultiSelect)},isControl:function(t){return BX.hasClass(t,this.classControl)},isDate:function(t){return BX.hasClass(t,this.classDate)},isControlInitialized:function(t){return this.data.some(function(i){return i.node===t},this)},get:function(t){var i=this.data.filter(function(i){return t===i.node});return i.length>0?i[0]:null}};BX.Main.ui.Factory=new BX.Main.ui.Factory})();
//# sourceMappingURL=core_ui_factory.map.js